package com.ids.enigha;


import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Window;
import android.view.WindowManager;
import com.ids.enigha.R;

public class SplashScreen extends Activity {

	// Splash screen timer
    private static int SPLASH_TIME_OUT =3000;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

//        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.splashscreen);
 
        new Handler().postDelayed(new Runnable() {
        	
            @Override
            public void run() {
            	
            	Intent i = null;
            	
//            	if(!isTrackingStarted())
            		i = new Intent(SplashScreen.this, LoginPage.class);
//            	else
//            		i = new Intent(SplashScreen.this, DisplayMapView.class);
            	
            	if(i != null)
            		startActivity(i);
 
                // close this activity
                finish();
            }
        }, SPLASH_TIME_OUT);
    }
    
    @Override
	public void onBackPressed() {
	}
    
    public void saveIsTrackingStarted(boolean isTrackingStarted)
	{
		SharedPreferences prefs = getSharedPreferences("ENIGHA_DETAILS", MODE_PRIVATE);
		Editor editor = prefs.edit();
		editor.putBoolean("isTrackingStarted", isTrackingStarted);
		editor.commit();
	}
    public boolean isTrackingStarted()
	{
		SharedPreferences prefs = getSharedPreferences("ENIGHA_DETAILS", MODE_PRIVATE);
		return prefs.getBoolean("isTrackingStarted", false);
	}
}
